package com.example.xpvideo.Controller;

import com.example.xpvideo.entity.PageResult;
import com.example.xpvideo.entity.ResponseResult;
import com.example.xpvideo.entity.req.PhpVideoReq;
import com.example.xpvideo.entity.req.UpdateReq;
import com.example.xpvideo.entity.res.PhpDiscoverRes;
import com.example.xpvideo.entity.res.PhpVideoRes;
import com.example.xpvideo.service.PhpDiscoverService;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author : 洪俊新
 * @date : 2021/9/14 17:16
 * @description:
 */
@RestController
@RequestMapping("/back/discover")
public class PhpDiscoverController {
    @Autowired
    private PhpDiscoverService phpDiscoverService;

    @GetMapping("/list")
    public ResponseResult<PageResult<List<PhpDiscoverRes>>> list(PhpVideoReq phpVideoReq)
            throws Exception{
        return phpDiscoverService.list(phpVideoReq);
    }

    @PostMapping("/delete")
    public ResponseResult<Object> delete(@RequestBody @NotNull
                                         UpdateReq updateReq) throws Exception{
        return phpDiscoverService.delete(updateReq);
    }
}
